/*
    BibleNotebook - A bible reader software
    Copyright (C) 2014  Williams Fernando Lopez

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
 */

package com.simplebible.dictionary.objects;

import java.util.List;

/**
 *
 * @author Williams Lopez
 */
public class NodeIndex {

    private NodeIndex parent;
    private List<NodeIndex> children;
    private List<String> words;
    private boolean leaf;
    private String value;

    public List<NodeIndex> getChildren() {
        return children;
    }

    public void setChildren(List<NodeIndex> children) {
        this.children = children;
    }

    public boolean isLeaf() {
        return (this.children==null || this.children.isEmpty());
    }

    public void setLeaf(boolean leaf) {
        this.leaf = leaf;
    }

    public NodeIndex getParent() {
        return parent;
    }

    public void setParent(NodeIndex parent) {
        this.parent = parent;
    }

    public String getValue() {
        return value;
    }

    public void setValue(String value) {
        this.value = value;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }

        if(obj instanceof String){
            if(this.value!=null){
                return this.value.equals(obj);
            }
        }

        if (getClass() != obj.getClass()) {
            return false;
        }
        final NodeIndex other = (NodeIndex) obj;
        if ((this.value == null) ? (other.value != null) : !this.value.equals(other.value)) {
            return false;
        }
        return true;
    }

    public List<String> getWords() {
        return words;
    }

    public void setWords(List<String> words) {
        this.words = words;
    }



    @Override
    public int hashCode() {
        int hash = 7;
        return hash;
    }


    

    

}
